<template>
  <div class="BP-Animation" :class="{ BP_Animation_change: Nowing }" @click="toAnimeMain(id)">
    <div class="BP-Animation_bg" :class="{ BPCard_p_bar: Nowing }"></div>
    <div
      class="Progress_bar"
      :class="[{ Progress_bar_walk: Mlafter }, { BPCard_p_bar: Nowing }]"
    ></div>
    <div class="BPCard">
      <ToDialog :isDialog="Nowing" />
      <div class="An-msg">
        <h4 class="banner_title">{{ title }}</h4>
        <h4 class="bottom-shade"></h4>
      </div>
      <slot />
    </div>
  </div>
</template>

<script>
import ToDialog from '../Global/ToDialog.vue'

import { toAnimeMain } from '@/router/jump'
export default {
  name: 'BannerPicCard',
  props: {
    title: {
      default: ''
    },
    Nowing: {
      default: false
    },
    Mlafter: {
      default: false
    },
    id: {
      default: 0
    }
  },
  components: {
    ToDialog
  },
  setup() {
    return {
      toAnimeMain
    }
  }
}
</script>

<style lang="scss" scoped>
@import '~style/anime.scss';

$Progress_bar: 5px;
$Progress_bar_cg: 10px;
$BP_Animation_w: 30px;
$BP_Animation_h: 15px;
.BP-Animation {
  cursor: pointer;
  position: relative;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 11px;
  transition: all 0.35s;
  .BP-Animation_bg {
    @extend .boxCenter;
    background-color: rgba($banner_rgb, 0.25);
    border-radius: 11px;
    overflow: hidden;
    z-index: 1;
    &::before {
      position: absolute;
      left: -10%;
      bottom: -100%;
      display: block;
      content: '';
      width: 120%;
      height: 100%;
      box-shadow: 0 -90px 32px $banner;
    }
  }
  .Progress_bar {
    @extend .boxCenter;
    border-radius: 11px;
    overflow: hidden;
    z-index: 2;
  }
  .Progress_bar_walk {
    &::before {
      @extend .alwaysUse;
      display: block;
      content: '';
      background-color: $banner;
      animation: starAsideAnime 3s linear;
    }
  }
}

.BPCard {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  z-index: 5;
  .banner_title {
    user-select: none;
    position: absolute;
    bottom: 0;
    width: 70%;
    text-indent: 10px;
    color: #fff;
    line-height: 30px;
    font-weight: 400;
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    z-index: 5;
  }
  .bottom-shade {
    position: absolute;
    bottom: -100%;
    left: -10%;
    width: 120%;
    height: 100%;
    box-shadow: 0 -10px 30px #000;
    z-index: 4;
    background-color: none;
  }
}
.BPCard_p_bar {
  width: calc(100% + $Progress_bar_cg) !important;
  height: calc(100% + $Progress_bar_cg) !important;
}
.BP_Animation_change {
  width: calc(100% + $BP_Animation_w) !important;
  height: calc(100% + $BP_Animation_h) !important;
}

.alwaysUse {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  height: 100%;
}
.boxCenter {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% + $Progress_bar);
  height: calc(100% + $Progress_bar);
}
</style>
